package util;


public class DoublePair implements Comparable{
	private String _word;

	private MiniDouble _number;

	public DoublePair(String word, double number) {
		_word = word;
		_number = new MiniDouble(number);
	}

	public double getNumber() {
		return _number.getValue();
	}
	public void setNumber(double number){
		_number=new MiniDouble(number);
	}
	public void increment(){
		_number.increment();
	}
	public void add(double x){
		_number.add(x);
	}

	public String getWord() {
		return _word;
	}
	public String toString(){
		return _word+", "+_number.getValue();
	}

	
	public int compareTo(Object arg0) {
		if (arg0 == null || (!(arg0 instanceof DoublePair))){
			System.out.println("Comparing error");
			return 0;
		}
		DoublePair x=(DoublePair) arg0;
		if (x.getNumber()<_number.getValue())			
			return -1;
		if (x.getNumber()>_number.getValue())			
			return 1;
		else
			return 0;
			
	}
}
